package com.jun.common.redis.stream;

import org.springframework.data.redis.core.RedisTemplate;

import java.util.Map;

/**
 * @author yuejun.li
 * @date 2024/8/13 22:51
 * redis stream发布者
 */
public class RedisStreamPublisher {

    private final RedisTemplate redisTemplate;

    public RedisStreamPublisher(RedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    public String produce(String key,Map<String, String> value) {
        return redisTemplate.opsForStream().add(key, value).getValue();
    }

}
